import request from '@/utils/request'
import storage from '@/utils/storage'

const dataInfo = JSON.parse(storage.get('userInfo'))

// 广告屏列表
export function fetchScreenList(params) {
    return request({
        url: '/operation/opScreen/queryList',
        method: 'get',
        params: {
        'businessAreaId':params.businessAreaId,
        'directoryId': params.directoryId,
        'entId':params.entId,
        'entName':params.entName,
        'entSimpleName':params.entSimpleName,
        'orgId': params.orgId,
        'serialNo': params.serialNo,
        'villageId': params.villageId,
        'villageName': params.villageName,
        'startDate': params.startDate,
        'endDate': params.endDate,
        'status': params.status,
        'pageIndex': params.pageIndex,
        'pageSize': params.pageSize
        },
        port: { ENV_PORT: 8004 },
        ajaxType2: 'reqGet'
    })
}

// 广告屏详情
export function screenDetail(id) {
    return request({
      url: '/operation/opScreen/detail',
      method: 'get',
      params: {'id': id},
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqGet'
    })
  }

//添加广告屏
export function screenAdd(data) {
    return request({
      url: '/operation/opScreen/add',
      method: 'post',
      data,
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqPost'
    })
  }

  // 删除广告屏
export function screenDelete(id) {
    return request({
      url: '/operation/opScreen/delete',
      method: 'delete',
      params:{id},
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqDelete'
    })
  }

    // 安装广告屏
export function screenInstall(data) {
  return request({
    url: '/operation/opScreen/install',
    method: 'post',
    data,
    port: { ENV_PORT: 8004 },
    ajaxType2: 'reqPost'
  })
}

// 广告屏指令
export function screenCommand(data) {
  return request({
    url: '/operation/opScreen/sendCommand',
    method: 'post',
    data,
    port: { ENV_PORT: 8004 },
    ajaxType2: 'reqPost'
  })
}

//修改广告屏
export function screenUpdate(data) {
  return request({
    url: '/operation/opScreen/update',
    method: 'put',
    data,
    port: { ENV_PORT: 8004 },
    ajaxType2: 'reqPut'

  })
}